package com.cy.pj.common.pojo;

import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;

/**
 * @author 张琪
 * @date 2020/11/13
 * @describe 借助此对象, 封装控制层响应到客户端的数据
 */

@Getter
@Setter
public class JsonResult implements Serializable {
    private static final long serialVersionUID = 5975354961493924621L;
    //    响应状态码, 1表示OK, 0表示false
    private Integer state = 1;

    //    响应状态码对应的响应信息
    private String message = "OK";

    //    正确的相应数据
    private Object data;

    public JsonResult(){}

    public JsonResult(String message){
        this.message = message;
    }

    public JsonResult(Object data){
        this.data = data;
    }

    public JsonResult(Throwable e){
        this.state = 0;
        this.message = e.getMessage();
    }

}
